package de.thw.web.object;

import java.util.Map;

import de.thw.web.model.Website;

public class Page extends AbstractObject {

	protected Website Website;

	protected Map<String, Area> Areas;

	protected Content Main;

	// /////////////////////////////////////////////////////////////////////////////

	public Website getWebsite() {
		return this.Website;
	};

	public void setWebsite(Website site) {
		this.Website = site;
	};

	public String getTitle() {

		String title = "";
		boolean WbesiteExists = (this.Website != null);
		if (WbesiteExists) {
			title = this.Website.getTitle();
		}

		if (this.Main != null) {
			if (this.Main.getTitle() != "") {
				if (WbesiteExists) {
					title += this.Website.getTitleSeperator();
				}
				title += this.Main.getTitle();
			}
		}

		return title;
	};

	public Map<String, Area> getAreas() {
		return this.Areas;
	};

	public void setAreas(Map<String, Area> map) {
		this.Areas = map;
	};

	public void addArea(String name, Area area) {
		this.Areas.put(name, area);
	};

	public Area getArea(String name) {
		return (Area) this.Areas.get(name);
	};

	public Content getMain() {
		return this.Main;
	};

	public void setMain(Content content) {
		this.Main = content;
	};

};